package com.test.netty.factory;

import com.test.netty.protocol.DubboProtocol;
import com.test.netty.protocol.Protocol;

public class ProtocolFactory {

    public static Protocol getProtocol(){

        //工厂模式
//        String name = System.getProperty("protocolName");
        String name = "dubbo";

        System.out.println("protocolName:" + name);

        if (name == null || name.equals("")) name = "http";
        switch (name) {
            //  case "http":
            //       return new HttpProtocol();
            case "dubbo":
                return new DubboProtocol();
            default:
                break;
        }
        return new DubboProtocol();
    }
}
